class Solution:
    def numJewelsInStones(self, J: str, S: str) -> int:
        SET = set(J) 
        ans = 0
        for s in S:
            if s in SET: ans += 1
        return ans